package com.zw.admin.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zw.admin.server.model.PGoodsStock;

@Mapper
public interface PGoodsStockDao {

    @Select("select * from p_goods_stock t where t.id = #{id}")
    PGoodsStock getById(Long id);

    @Delete("delete from p_goods_stock where id = #{id}")
    int delete(Long id);

    int update(PGoodsStock pGoodsStock);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into p_goods_stock(item_no, sku, stock, unit, createTime, updateTime) values(#{itemNo}, #{sku}, #{stock}, #{unit}, #{createTime}, #{updateTime})")
    int save(PGoodsStock pGoodsStock);
    
    int insert(PGoodsStock pGoodsStock);
    
    int count(@Param("params") Map<String, Object> params);

    List<PGoodsStock> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
     
    List<PGoodsStock> listBySku(@Param("itemNoList") List<String> itemNoList ,@Param("skuList") List<String> skuList); 
}
